package com.topnav.mc.test;

import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.js.lib.result.Result;
import com.topnav.mc.listener.bean.DeviceAlarmMessage;
import com.topnav.mc.listener.bean.YLDeviceInfo;
import com.topnav.mc.uitls.RedisUtil;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: kenny
 * @Date: 2024/4/8 13:41
 */@RestController
@CrossOrigin
@RequestMapping("test/simulate/")
public class SimulateYlDeviceInfoController {
    /**
     * YlDeviceInfo 报警测试
     * @param data
     * @return
     */
    @PostMapping("yldeviceinfo/post")
    @ResponseBody
    public Result yldeviceinfoPost(@RequestBody YLDeviceInfo data) {
        String key = "YLDeviceInfo";
        // (JSONObject) JSON.toJSON(data);
        RedisUtil.publish(key,(JSONObject) JSON.toJSON(data));

        return Result.ok();
    }
}
